import debounce from 'lodash/debounce.js'

window.$debounce = debounce
window.$findTreeNode = function(nodes, id) {
  for (let node of nodes) {
    if (id === node.id) {
      return node
    }
    if (node.children) {
      let n = window.$findTreeNode(node.children, id)
      if (n) {
        return n
      }
    }
  }
  return null
}
